package com.eltsistemas.view.funcionario;

import com.eltsistemas.adapter.Mascara;
import com.eltsistemas.adapter.Mensagem;
import com.eltsistemas.controller.FuncionarioController;
import com.eltsistemas.modelo.Funcionario;

public class Frm_FuncionarioAlt extends javax.swing.JDialog {

    private static Frm_Funcionario frm_Mecanico;
    private Mascara mascara = new Mascara();
    
    public Frm_FuncionarioAlt() {
        initComponents();
        setLocationRelativeTo(null);
    }
    
    protected void setObject(Frm_Funcionario frm_Mecanico)
    {
       this.frm_Mecanico = frm_Mecanico;
    }
    
    protected void exibeDados(Funcionario funcionario)
    {
        tf_cod.setText(""+funcionario.getId());
        cb_situacao.setSelectedItem(funcionario.getSituacao());
        cb_funcao.setSelectedItem(funcionario.getFuncao());
        tf_nome.setText( funcionario.getNomeCompleto());
        tf_cpf.setText(funcionario.getCpf());
        tf_rg.setText(funcionario.getRg());
        tf_comissao.setText(""+funcionario.getComissao());
        tf_endereco.setText(funcionario.getEndereco());
        tf_bairro.setText(funcionario.getBairro());
        tf_cidade.setText(funcionario.getCidade());
        cb_uf.setSelectedItem(funcionario.getUf());
        tf_cep.setText(funcionario.getCep());
        tf_telefone.setText(funcionario.getTelefone());
        tf_celular.setText(funcionario.getCelular());
        tf_email.setText(funcionario.getEmail());;
        tf_obs.setText(funcionario.getObs());
    }
    
     private void altera()
    {
        if(!tf_nome.getText().trim().isEmpty() && !tf_cpf.getText().trim().isEmpty() && 
           /*!tf_dataCadastro.getText().trim().isEmpty() &&*/ !tf_email.getText().trim().isEmpty())
        {
           Funcionario funcionario = new Funcionario();
           
           funcionario.setId(Long.parseLong(tf_cod.getText()));
           funcionario.setSituacao(cb_situacao.getSelectedItem().toString());
           funcionario.setFuncao(cb_funcao.getSelectedItem().toString());
           funcionario.setNomeCompleto(tf_nome.getText().trim() );
           funcionario.setCpf( tf_cpf.getText().trim());
           funcionario.setRg(tf_rg.getText().trim());
           funcionario.setComissao(Double.parseDouble(tf_comissao.getText().trim()));
           funcionario.setEndereco(tf_endereco.getText().trim());
           funcionario.setBairro(tf_bairro.getText().trim());
           funcionario.setCidade(tf_cidade.getText().trim());
           funcionario.setUf(cb_uf.getSelectedItem().toString());
           funcionario.setCep(tf_cep.getText().trim());
           funcionario.setTelefone(tf_telefone.getText().trim());
           funcionario.setCelular(tf_celular.getText().trim());
           funcionario.setEmail(tf_email.getText().trim());
           funcionario.setObs(tf_obs.getText().trim());
   
            FuncionarioController funcionarioController = new FuncionarioController();
            if (funcionarioController.altera(funcionario) == true)
            {
                new Mensagem().msg_Exito("Mecânico", "alterado");
                frm_Mecanico.carregaTabela();
                this.dispose();
            }
            
            else
            {
                new Mensagem().msg_JaExiste("Mecânico");
            }
        }
        
        else
        {
            new Mensagem().msg_CampoVazio();
        }
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanelFundo = new javax.swing.JPanel();
        jLabelTel = new javax.swing.JLabel();
        tf_telefone = new javax.swing.JFormattedTextField();
        tf_celular = new javax.swing.JFormattedTextField();
        jLabelCel = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel11 = new javax.swing.JLabel();
        jLabelEnd = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tf_endereco = new javax.swing.JTextPane();
        jLabelNum = new javax.swing.JLabel();
        tf_bairro = new javax.swing.JTextField();
        jLabelBairro = new javax.swing.JLabel();
        tf_cidade = new javax.swing.JTextField();
        jLabelCid = new javax.swing.JLabel();
        jLabelCep = new javax.swing.JLabel();
        tf_cep = new javax.swing.JFormattedTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        tf_obs = new javax.swing.JTextPane();
        jLabelObs = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        tf_dataCadastro = new javax.swing.JFormattedTextField();
        tf_email = new javax.swing.JFormattedTextField();
        jLabelCep1 = new javax.swing.JLabel();
        cb_uf = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        tf_nome = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        tf_comissao = new javax.swing.JTextField();
        tf_cpf = new javax.swing.JFormattedTextField();
        tf_rg = new javax.swing.JFormattedTextField();
        jLabel6 = new javax.swing.JLabel();
        tf_cod = new javax.swing.JTextField();
        jLabelPessoa = new javax.swing.JLabel();
        cb_situacao = new javax.swing.JComboBox();
        jLabelPessoa1 = new javax.swing.JLabel();
        cb_funcao = new javax.swing.JComboBox();
        btnOk = new javax.swing.JButton();
        btnCan = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Mecânico | Editar");

        jPanelFundo.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabelTel.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelTel.setText("Telefone");

        tf_telefone.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        tf_telefone.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        tf_telefone.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tf_telefoneMouseClicked(evt);
            }
        });
        tf_telefone.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                tf_telefoneFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                tf_telefoneFocusLost(evt);
            }
        });

        tf_celular.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        tf_celular.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        tf_celular.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tf_celularMouseClicked(evt);
            }
        });
        tf_celular.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                tf_celularFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                tf_celularFocusLost(evt);
            }
        });

        jLabelCel.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelCel.setText("Celular");

        jLabel11.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
        jLabel11.setText("Endereço");

        jLabelEnd.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelEnd.setText("Rua, Av.");

        tf_endereco.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jScrollPane1.setViewportView(tf_endereco);

        jLabelNum.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelNum.setText("Bairro");

        tf_bairro.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        tf_bairro.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabelBairro.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelBairro.setText("Cidade");

        tf_cidade.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        tf_cidade.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabelCid.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelCid.setText("UF");

        jLabelCep.setText("CEP");

        tf_cep.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        tf_cep.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        tf_cep.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tf_cepMouseClicked(evt);
            }
        });
        tf_cep.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                tf_cepFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                tf_cepFocusLost(evt);
            }
        });

        jScrollPane2.setViewportView(tf_obs);

        jLabelObs.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelObs.setText("Observações");

        jLabel1.setText("Data cadastro");

        tf_dataCadastro.setEditable(false);
        tf_dataCadastro.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        tf_dataCadastro.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N

        tf_email.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        tf_email.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N

        jLabelCep1.setText("Email");

        cb_uf.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        cb_uf.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "AC", "Al", "AM", "AP", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PE", "PI", "PR", "RJ", "RN", "RO", "RR", "RS", "SC", "SE", "SP", "TO" }));

        jLabel2.setText("Nome completo");

        jLabel3.setText("CPF");

        jLabel4.setText("RG");

        jLabel5.setText("Comissão(%)");

        tf_cpf.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tf_cpfMouseClicked(evt);
            }
        });
        tf_cpf.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                tf_cpfFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                tf_cpfFocusLost(evt);
            }
        });

        tf_rg.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tf_rgMouseClicked(evt);
            }
        });
        tf_rg.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                tf_rgFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                tf_rgFocusLost(evt);
            }
        });

        jLabel6.setText("Cód.");

        tf_cod.setEditable(false);
        tf_cod.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tf_codActionPerformed(evt);
            }
        });

        jLabelPessoa.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelPessoa.setText("Situação");

        cb_situacao.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        cb_situacao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Ativo", "Inativo" }));

        jLabelPessoa1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jLabelPessoa1.setText("Função");

        cb_funcao.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        cb_funcao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Mecânico", "Vendedor", "Outro" }));

        javax.swing.GroupLayout jPanelFundoLayout = new javax.swing.GroupLayout(jPanelFundo);
        jPanelFundo.setLayout(jPanelFundoLayout);
        jPanelFundoLayout.setHorizontalGroup(
            jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFundoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelFundoLayout.createSequentialGroup()
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabelEnd)
                                    .addComponent(jLabel11)
                                    .addComponent(jLabelNum)
                                    .addComponent(jLabelCid))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                                        .addComponent(tf_bairro, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabelBairro)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tf_cidade))
                                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                                        .addComponent(cb_uf, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabelCep)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tf_cep, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(33, 33, 33)
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane2)
                                    .addComponent(jLabelObs)))
                            .addGroup(jPanelFundoLayout.createSequentialGroup()
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                                        .addGap(0, 0, Short.MAX_VALUE)
                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addGroup(jPanelFundoLayout.createSequentialGroup()
                                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                                                        .addComponent(jLabel3)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(tf_cpf, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                            .addComponent(jLabel1)
                                                            .addComponent(jLabel4)
                                                            .addComponent(jLabel5))
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                                .addComponent(tf_comissao, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(tf_dataCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                            .addComponent(tf_rg, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                                .addGap(166, 166, 166))
                                            .addGroup(jPanelFundoLayout.createSequentialGroup()
                                                .addComponent(jLabel2)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(tf_nome, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                                        .addGap(65, 65, 65)
                                        .addComponent(jLabel6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tf_cod, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelFundoLayout.createSequentialGroup()
                                            .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addComponent(jLabelCel)
                                                .addComponent(jLabelTel))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(tf_telefone, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(tf_celular, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelFundoLayout.createSequentialGroup()
                                            .addComponent(jLabelCep1)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(tf_email, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelFundoLayout.createSequentialGroup()
                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jLabelPessoa1)
                                            .addComponent(jLabelPessoa))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(cb_situacao, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(cb_funcao, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(9, 9, 9)))))
                        .addGap(12, 12, 12))
                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 622, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(27, Short.MAX_VALUE))))
        );
        jPanelFundoLayout.setVerticalGroup(
            jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFundoLayout.createSequentialGroup()
                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelFundoLayout.createSequentialGroup()
                                .addGap(79, 79, 79)
                                .addComponent(tf_telefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(tf_celular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelFundoLayout.createSequentialGroup()
                                .addGap(87, 87, 87)
                                .addComponent(jLabelTel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabelCel)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelCep1)
                            .addComponent(tf_email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(26, 26, 26))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelFundoLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelFundoLayout.createSequentialGroup()
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(cb_situacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabelPessoa))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabelPessoa1)
                                    .addComponent(cb_funcao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanelFundoLayout.createSequentialGroup()
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel6)
                                    .addComponent(tf_cod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel2)
                                            .addComponent(tf_nome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel3)
                                            .addComponent(tf_cpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel4)
                                            .addComponent(tf_rg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                                        .addGap(81, 81, 81)
                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel1)
                                            .addComponent(tf_dataCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel5)
                                            .addComponent(tf_comissao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelEnd)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelNum)
                            .addComponent(tf_bairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelBairro)
                            .addComponent(tf_cidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanelFundoLayout.createSequentialGroup()
                        .addComponent(jLabelObs)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabelCid)
                        .addComponent(cb_uf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(tf_cep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabelCep)))
                .addContainerGap(20, Short.MAX_VALUE))
        );

        btnOk.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        btnOk.setText("Ok");
        btnOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOkActionPerformed(evt);
            }
        });

        btnCan.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        btnCan.setText("Cancelar");
        btnCan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCanActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelFundo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnCan)
                .addGap(58, 58, 58))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanelFundo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnOk)
                    .addComponent(btnCan))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tf_telefoneMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tf_telefoneMouseClicked
        mascara.getFormating(tf_telefone, "(##)####-####");
    }//GEN-LAST:event_tf_telefoneMouseClicked

    private void tf_telefoneFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_telefoneFocusGained
        mascara.getFormating(tf_telefone, "(##)####-####");
    }//GEN-LAST:event_tf_telefoneFocusGained

    private void tf_telefoneFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_telefoneFocusLost
        mascara.getVerifyFormatingEmpty(tf_telefone);
    }//GEN-LAST:event_tf_telefoneFocusLost

    private void tf_celularMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tf_celularMouseClicked
        mascara.getFormating(tf_celular, "(##)####-####");
    }//GEN-LAST:event_tf_celularMouseClicked

    private void tf_celularFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_celularFocusGained
        mascara.getFormating(tf_celular, "(##)####-####");
    }//GEN-LAST:event_tf_celularFocusGained

    private void tf_celularFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_celularFocusLost
        mascara.getVerifyFormatingEmpty(tf_celular);
    }//GEN-LAST:event_tf_celularFocusLost

    private void tf_cepMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tf_cepMouseClicked
        mascara.getFormating(tf_cep, "#####-###");
    }//GEN-LAST:event_tf_cepMouseClicked

    private void tf_cepFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_cepFocusGained
        mascara.getFormating(tf_cep, "#####-###");
    }//GEN-LAST:event_tf_cepFocusGained

    private void tf_cepFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_cepFocusLost
        mascara.getVerifyFormatingEmpty(tf_cep);
    }//GEN-LAST:event_tf_cepFocusLost

    private void tf_cpfMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tf_cpfMouseClicked
        mascara.getFormating(tf_cpf, "###.###.###-##");
    }//GEN-LAST:event_tf_cpfMouseClicked

    private void tf_cpfFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_cpfFocusGained
        mascara.getFormating(tf_cpf, "###.###.###-##");
    }//GEN-LAST:event_tf_cpfFocusGained

    private void tf_cpfFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_cpfFocusLost
        mascara.getVerifyFormatingEmpty(tf_cpf);
    }//GEN-LAST:event_tf_cpfFocusLost

    private void tf_rgMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tf_rgMouseClicked
        mascara.getFormating(tf_rg, "#.###.###");
    }//GEN-LAST:event_tf_rgMouseClicked

    private void tf_rgFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_rgFocusGained
        mascara.getFormating(tf_rg, "#.###.###");
    }//GEN-LAST:event_tf_rgFocusGained

    private void tf_rgFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_rgFocusLost
        mascara.getVerifyFormatingEmpty(tf_rg);
    }//GEN-LAST:event_tf_rgFocusLost

    private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
        altera();
    }//GEN-LAST:event_btnOkActionPerformed

    private void btnCanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCanActionPerformed
        this.dispose();
    }//GEN-LAST:event_btnCanActionPerformed

    private void tf_codActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tf_codActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tf_codActionPerformed

    public static void main(String args[]) {
           java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Frm_FuncionarioAlt dialog = new Frm_FuncionarioAlt();
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCan;
    private javax.swing.JButton btnOk;
    private javax.swing.JComboBox cb_funcao;
    private javax.swing.JComboBox cb_situacao;
    private javax.swing.JComboBox cb_uf;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabelBairro;
    private javax.swing.JLabel jLabelCel;
    private javax.swing.JLabel jLabelCep;
    private javax.swing.JLabel jLabelCep1;
    private javax.swing.JLabel jLabelCid;
    private javax.swing.JLabel jLabelEnd;
    private javax.swing.JLabel jLabelNum;
    private javax.swing.JLabel jLabelObs;
    private javax.swing.JLabel jLabelPessoa;
    private javax.swing.JLabel jLabelPessoa1;
    private javax.swing.JLabel jLabelTel;
    private javax.swing.JPanel jPanelFundo;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField tf_bairro;
    private javax.swing.JFormattedTextField tf_celular;
    private javax.swing.JFormattedTextField tf_cep;
    private javax.swing.JTextField tf_cidade;
    private javax.swing.JTextField tf_cod;
    private javax.swing.JTextField tf_comissao;
    private javax.swing.JFormattedTextField tf_cpf;
    private javax.swing.JFormattedTextField tf_dataCadastro;
    private javax.swing.JFormattedTextField tf_email;
    private javax.swing.JTextPane tf_endereco;
    private javax.swing.JTextField tf_nome;
    private javax.swing.JTextPane tf_obs;
    private javax.swing.JFormattedTextField tf_rg;
    private javax.swing.JFormattedTextField tf_telefone;
    // End of variables declaration//GEN-END:variables
}
